package com.yungu.swift.socket.communication.server.handler.strategy;

import com.google.gson.Gson;
import com.yungu.swift.base.SpringContextHolder;
import com.yungu.swift.socket.communication.message.UploadLocationJsonMessage;
import com.yungu.swift.socket.communication.service.UploadLocationService;
import io.netty.channel.ChannelHandlerContext;

/**
 * 批量上传点响应
 *
 * @author : cuixiuyin
 * @date : 2019/8/30
 */
public class BatchUploadLocationHandler implements MessageHandler {

    @Override
    public void handler(ChannelHandlerContext channelHandlerContext, String text) {
        Gson gson = new Gson();
        UploadLocationJsonMessage uploadLocationJsonMessage = gson.fromJson(text, UploadLocationJsonMessage.class);
        //处理业务逻辑
        UploadLocationService uploadLocationService = SpringContextHolder.getBean(UploadLocationService.class);
        uploadLocationService.uploadDriverLocations(uploadLocationJsonMessage);
    }
}
